﻿namespace Learun.DataBase.Repository
{
    /// <summary>
    /// 自定义的仓储类，里面根据不同的字符串情况，来往后走。用于new的
    /// </summary>
    public class RepositoryFactory
    {
        public IRepository BaseRepository(string connString, DatabaseType type)
        {
            return new Repository(DbFactory.GetIDatabase(connString, type));
        }

        public IRepository BaseRepository(string connString, string type)
        {
            return new Repository(DbFactory.GetIDatabase(connString, type));
        }

        public IRepository BaseRepository(string name)
        {
            return new Repository(DbFactory.GetIDatabase(name));
        }
        /// <summary>
        /// 可能是读取默认的连接字符串
        /// </summary>
        /// <returns></returns>
        public IRepository BaseRepository()
        {
            return new Repository(DbFactory.GetIDatabase());
        }
    }
}
